package com.lonelyzhe.springboot.service.impl;

import com.lonelyzhe.springboot.bean.User;
import com.lonelyzhe.springboot.bean.vo.Login;
import com.lonelyzhe.springboot.mapper.UserMapper;
import com.lonelyzhe.springboot.service.IUserService;
import com.lonelyzhe.springboot.utils.MD5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.jws.soap.SOAPBinding;

@Service
public class UserService implements IUserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public User checkLogin(Login login_info) {
        login_info.setPassword(MD5Util.md5(login_info.getPassword()));
        User user = userMapper.checkLogin(login_info);
        if (user != null){
            return user;
        } else {
            return null;
        }
    }

    @Override
    public void register(User user) {
        user.setPassword(MD5Util.md5(user.getPassword()));
        userMapper.register(user);
    }

    public static void main(String[] args) {
        double[] a = new double[]{0,63,30,0,1,74,32.6,0.6,2,91.5,55.1,0.9,3,80,118.6,0.4,4,71,96,0.4,5,37.5,74.3,0.5,6,39.3,43.4,0.5,7,47.2,34.2,0.8,8,43.5,33.4,0.7,9,45,32.1,1.5,10,52.5,30,0.7,11,44.8,25.1,0.6,12,43.6,26.7,1,13,40.6,25.2,0.9,14,46.5,13.4,0.4,15,49.2,3.5,0.9,16,56.6,30.1,0.3,17,57.4,25.1,0.7,18,71.5,30.9,0.5};
            for(int j=0; j<20; j++){
                for(int i=j*4; i<j*4+4; i++){
                    System.out.print(a[i]);
                    if(i != j*4+3){
                        System.out.print(",");
                    }
            }
            System.out.println();
        }

    }
}
